#ifndef __LIGHT_COMMAND_LIST_H__
#define __LIGHT_COMMAND_LIST_H__
#include <ltPtcParse.h>

// =============command rwSn(write or read serial number) begin=====================
#if DEVICE_PLATFORM_CONFIGURE != DEVICE_PLATFORM_C51_MCU
#pragma pack(1)
#endif
struct ltCmdStciDef(rwSn)
{
    char wSn[LT_CMD_SN_MAX_SIZE];
};
struct ltCmdStcoDef(rwSn)
{
    char rSn[LT_CMD_SN_MAX_SIZE];
};
union ltCmdUnionDef(rwSn)
{
    struct ltCmdStciDef(rwSn) idt;
    struct ltCmdStcoDef(rwSn) odt;
};
void ltCmdFunOvtiDef(rwSn)(struct ltCmdStciDef(rwSn) * idt);
void ltCmdFunOvtoDef(rwSn)(struct ltCmdStcoDef(rwSn) * odt);
#if LT_PTC_CMD_SUB_ENABLE
void ltCmdFunSubDoDef(rwSn)(union ltCmdUnionDef(rwSn) * iodt, struct ltPtcPsStc *ptcptr);
#endif
#if LT_PTC_CMD_HOST_ENABLE
int ltCmdFunHostPackDef(rwSn)(struct ltPtcPsStc *ptcptr, const char *inwSn);
int ltCmdFunHostDealDef(rwSn)(struct ltCmdStcoDef(rwSn) * odt, struct ltPtcPsStc *ptcptr);
#endif
// =============command rwSn(write or read serial number) end======================

// =============command rwAddr(write or read address) begin=====================
struct ltCmdStciDef(rwAddr)
{
    char cfgSn[LT_CMD_SN_MAX_SIZE];
    uint8_t rwflag;// 0:read; 1:write
    uint8_t wAddr;// write addr
};
struct ltCmdStcoDef(rwAddr)
{
    uint8_t rAddr;// read addr
};
union ltCmdUnionDef(rwAddr)
{
    struct ltCmdStciDef(rwAddr) idt;
    struct ltCmdStcoDef(rwAddr) odt;
};
void ltCmdFunOvtiDef(rwAddr)(struct ltCmdStciDef(rwAddr) * idt);
void ltCmdFunOvtoDef(rwAddr)(struct ltCmdStcoDef(rwAddr) * odt);
#if LT_PTC_CMD_SUB_ENABLE
void ltCmdFunSubDoDef(rwAddr)(union ltCmdUnionDef(rwAddr) * iodt, struct ltPtcPsStc *ptcptr);
#endif
#if LT_PTC_CMD_HOST_ENABLE
int ltCmdFunHostPackDef(rwAddr)(struct ltPtcPsStc *ptcptr, const char *inSn, const char inaddr, const char inflag);
int ltCmdFunHostDealDef(rwAddr)(struct ltCmdStcoDef(rwAddr) * odt, struct ltPtcPsStc *ptcptr);
#endif
// =============command rwAddr(write or read address) end======================

// =============command getInf begin=====================
struct ltCmdStciDef(getInf)
{
    char dlgKey[16];
};
struct ltCmdStcoDef(getInf)
{
    uint16_t dlgcrc;
    char rvers[30];
    char rsn[LT_CMD_SN_MAX_SIZE];
};
union ltCmdUnionDef(getInf)
{
    struct ltCmdStciDef(getInf) idt;
    struct ltCmdStcoDef(getInf) odt;
};
void ltCmdFunOvtiDef(getInf)(struct ltCmdStciDef(getInf) * idt);
void ltCmdFunOvtoDef(getInf)(struct ltCmdStcoDef(getInf) * odt);
#if LT_PTC_CMD_SUB_ENABLE
void ltCmdFunSubDoDef(getInf)(union ltCmdUnionDef(getInf) * iodt, struct ltPtcPsStc *ptcptr);
#endif
#if LT_PTC_CMD_HOST_ENABLE
int ltCmdFunHostPackDef(getInf)(struct ltPtcPsStc *ptcptr, uint8_t inaddr, const char *inkey);
int ltCmdFunHostDealDef(getInf)(struct ltCmdStcoDef(getInf) * odt, struct ltPtcPsStc *ptcptr);
#endif
// =============command getInf end======================

// =============command heartBeat begin=====================
struct ltCmdStciDef(heartBeat)
{
    char resvSnd[16];
};
struct ltCmdStcoDef(heartBeat)
{
    char resvResp[16];
};
union ltCmdUnionDef(heartBeat)
{
    struct ltCmdStciDef(heartBeat) idt;
    struct ltCmdStcoDef(heartBeat) odt;
};
void ltCmdFunOvtiDef(heartBeat)(struct ltCmdStciDef(heartBeat) * idt);
void ltCmdFunOvtoDef(heartBeat)(struct ltCmdStcoDef(heartBeat) * odt);
#if LT_PTC_CMD_SUB_ENABLE
void ltCmdFunSubDoDef(heartBeat)(union ltCmdUnionDef(heartBeat) * iodt, struct ltPtcPsStc *ptcptr);
#endif
#if LT_PTC_CMD_HOST_ENABLE
int ltCmdFunHostPackDef(heartBeat)(struct ltPtcPsStc *ptcptr, uint8_t inaddr, const char *inres);
int ltCmdFunHostDealDef(heartBeat)(struct ltCmdStcoDef(heartBeat) * odt, struct ltPtcPsStc *ptcptr);
#endif
// =============command heartBeat end======================

#if DEVICE_PLATFORM_CONFIGURE != DEVICE_PLATFORM_C51_MCU
#pragma pack()
#endif

enum ltCmdEnumList
{
    ltCmdEnumDef(rwSn),
    ltCmdEnumDef(rwAddr),
    ltCmdEnumDef(getInf),
    ltCmdEnumDef(heartBeat),
};
#if LT_PTC_CMD_SUB_ENABLE
void ltCmdSubDealByID(struct ltPtcPsStc *ptcptr);
#endif
#if LT_PTC_CMD_HOST_ENABLE
int ltCmdHostDealByID(struct ltPtcPsStc *ptcptr);
#endif
#endif